package com.zk.box.service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zk.box.mapper.UserMapper;
import com.zk.box.model.User;
import com.zk.box.model.UserExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 15911 on 2019/1/27.
 */
@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public Object getUser(Integer id){
        return userMapper.selectByPrimaryKey(id);
    }

    public Object getUsers() {
        PageHelper.startPage(1, 10);
        List<User> users = userMapper.selectByExample(new UserExample());
        PageInfo<User> pageInfo = new PageInfo<>(users);
        return pageInfo;
    }
}
